import java.util.*;
import java.text.*;

public class testConvert
{
    public static void main(String[]args)
    {
	Scanner keybd = new Scanner(System.in);
	CalLogic cal = new CalLogic();

	String time = new String();

	do
	{
	    System.out.print("Time (AM/PM): ");
	    time = keybd.nextLine();
	    System.out.println();

	    if(!time.equalsIgnoreCase("done"))
	    {
		if(cal.validTime(time))
		{
		    try
		    {
			System.out.println(cal.AMPMtoMil(time) + '\n');
		    }
		    catch(Exception e)
		    {
			System.out.println("The given time was not valid.");
			System.out.println("All times must be given in the format:");
			System.out.println("\n\thh:mm:ss am/pm\n");
		    }
		}
	    }
	}
	while(!time.equalsIgnoreCase("done"));
    }
}
